ユーザー:Tommy6/WikiCode - Drafting Collaboration
Forum Discussion (Drafting Project - WikiCode) Extensions which may be Partially-Derived from * ParserFunctions * ParserFunctions (extended) * MathStatFunctions * StringFunctions * RegexParserFunctions * DynamicFunctions * LoopFunctions * Control Structure Functions * Character Escapes * VariablesExtension * DynamicPageList 各機能 #expr: :ParserFunctions (extended)より * ''式 部分に書かれた数式が評価されます。 * VarNは、''式''内で''値''に置き換えられる変数です。 ;改善点 * * The Unicode mathematical characters are aliased to their respective commands: × ÷ ≠ * * The Unicode power characters are aliased to their respective pow command: ¹ ² ³ * * The Unicode fraction characters are aliased to their respective numerical value: ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ * * Variables such as x in an equation can be replaced with a flat value defined in the extra parameters. ;コメント * * While it is true that normal variables can be used inside the expression itself to do math, there are positives to using it outside of the expression. ** When using mathematical formula using variables many times it is less server intensive to have the flat number dropped in from an extra parameter than it is to evaluate things multiple times. Especially if you break up repeat sub formula into another #expr and use it in a variable. (Useful for wiki such as a physics wiki). *** Ex: ** Sometimes values created by functions like rand: are used, these cannot be used in multiple parts of the formula because they would output a different value and ruin the calculation. *** Ex: }} ;Positive rationale ;Negative rationale #if: :Derived from: ParserFunctions. #ifeq: :Derived from: ParserFunctions. #ifexpr: :Derived from: ParserFunctions. #ifexist: :Derived from: ParserFunctions. * Page name is the page title to check for existence. * Then is the text to output if Page name exists. * Else is the text to output if Page name does not exist. ;Improvements ;Neutral comments ;Positive rationale ;Negative rationale #ifanyexist: * Page name list is a comma separated list of page titles to check for existence of. If the title has a comma inside of it, then you may use the Link syntax inside of the list so that the commas inside of the link do not separate the link. * Then is the text to output if any of the page names exist. * Else is the text to output if none of the page names exist. ;Improvements ;Neutral comments * The comma is a legal title character so this won't match titles with a comma inside of it. If anyone has an idea for a better splitting character, or list syntax feel free to comment. ~ NOTASTAFF Dantman(Talk) ** Perhaps using the actual title syntax inside of the list would be an idea. Like Title1, Title2, Title3, a. To keep compatible with normal syntax we can allow for things like this Title1, Title2, A, B, C, Title4, Title5 so users only need use title syntax when using a title with a comma inside of it. ~ NOTASTAFF Dantman(Talk) ;Positive rationale * Use of this function will use only a single Database Query. Because of this, using it once is much softer on the server than using multiple #ifexist''s'' is. ;Negative rationale #findexist: * Page name list is a comma separated list of page titles to check for existence of. If the title has a comma inside of it, then you may use the Link syntax inside of the list so that the commas inside of the link do not separate the link. * Then is the text to output if any of the page names exist. The string defined by Replacement Text will be replaced with the leftmost title in the list which is found. * Else is the text to output if none of the page names exist. * Replacement Text is the text in Then to replace with the found title. Defaults to $s$. ;Improvements ;Neutral comments ;Positive rationale * Use of this function will use only a single Database Query. Because of this, using it once is much softer on the server than using multiple #ifexist''s'' is. ** However since it returns the leftmost listed title it cannot have the single returned row limit that ifanyexist: does. This is primarily used for something like rather than just testing if one of a set of pages exists. ;Negative rationale #switch: :Derived from: ParserFunctions. * Cond? is the value to match against Var. This is evaluated in the same was as in the extension being derived from. * The last value is considered the default, if you don't have one of these, then a #default will be looked for (For more readable #switch''es''.) ;Improvements ;Neutral comments ;Positive rationale ;Negative rationale #repeat: #for: :Derived from: LoopFunctions. #foreach: :Derived from: LoopFunctions. #range: #forrange: #len: :Derived from: StringFunctions. #pos: :Derived from: StringFunctions. #rpos: :Derived from: StringFunctions. #sub: :Derived from: StringFunctions. #pad: :Derived from: StringFunctions. ;Improvements * Add compatibility for non-ASCII characters. The actual extension has the same bug as and . http://bugzilla.wikimedia.org/show_bug.cgi?id=12324 #replace: :Derived from: StringFunctions. #regex: :Derived from: RegexParserFunctions. #split: #explode: :Derived from: StringFunctions. ;Improvements * A #split alias is added since normal editors can understand the use of the word split than the word explode in terms of text. ;Neutral comments ;Positive rationale ;Negative rationale #splice: * Text is the string of text to split apart. * Split Text is the set of characters to split the text by. * Splice Pattern is the pattern of text to put the text that was separated. * Replacement Text is the text inside of the Splice Pattern to replace with the separated text. Defaults to $s$. ;Improvements ;Neutral comments * A good name is open for discussion, #splitpattern was the best I could come up with. But I'm sure that someone can come up with a better name that people will understand. ~ NOTASTAFF Dantman(Talk) ** Hmm, I got a better one. I'm calling it #splice now, sounds more understandable. ~ NOTASTAFF Dantman(Talk) * I'm considering adding some extra substitution patterns or prefix/suffixes for things like the last, first, etc... That way things like the "and" can be added to a list without resorting to the use of a hard to understand expr: which adds more server load. ~ NOTASTAFF Dantman(Talk) ;Positive rationale ;Negative rationale #urlencode: :Derived from: StringFunctions. #urldecode: :Derived from: StringFunctions. Proposed Configuration Variables Code Area Disable/Enable WikiCode::$cUseUncacheableFunctions :Default: true * Enables/Disables use of the Functions which need constant re-parsing of the page: ** #time: ** #rand: WikiCode::$cUseStringFunctions :Default: true * Enables/Disables use of the String Alteration/Testing Functions: ** #len: ** #pos: ** #rpos: ** #sub: ** #pad: ** #replace: ** #regex: ** #explode: ** #urlencode: ** #urldecode: WikiCode::$cUseRegex :Default: true * Enables/Disables use of functions which allow use of Regular Expressions: ** #regex: Limits WikiCode::$cLimitIfExist :Derived from: ParserFunctions. ::Alias: '$wgMaxIfExistCount';'' :::''Default: 100 WikiCode::$cLimitTitleQuery :Default: 250 * Similar to $cLimitIfExist, but applies to all title querying functions to limit the querying of any title. WikiCode::$cLimitTimeChars :Derived from: ParserFunctions. ::Alias: '''ExtParserFunctions::$mMaxTimeChars';'' :::Default: 6000 WikiCode::$cLimitStringSearch :Derived from: StringFunctions. ::Alias: '$wgStringFunctionsLimitSearch';'' :::''Default: 30 WikiCode::$cLimitStringReplace :Derived from: StringFunctions. ::Alias: '$wgStringFunctionsLimitReplace';'' :::''Default: 30 WikiCode::$cLimitStringPad :Derived from: StringFunctions. ::Alias: '$wgStringFunctionsLimitPad';'' :::''Default: 100 WikiCode::$cLimitLoopCount :Derived from: LoopFunctions. ::Alias: '''ExtLoopFunctions::$mMaxLoopCount';'' :::Default: 100 * Defines maximum number of loops allowed per session. Proposed Escapes = :Derived from: Character Escapes. * Created with a Parser Tag. * Can only work for a flat depth ( will be treated like '') = * Created with a ParserHook instead of a ParserTag. * Deeper levels may be created with higher values in the #. * Deeper levels will likely need to start at 1 and not skip any numbers. (ie: will not unescape the one inside past )